package com.qk.management.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qk.dto.course.CourseDTO;
import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 *
 *
 * @author blusr
 * @version 1.0
 * @date 2025/10/7 20:53
 */
@Mapper
public interface CourseMapper extends BaseMapper<Course> {
    List<Course> list(CourseDTO courseDTO);

    @Insert("insert into t_course(subject, name, price, target, description, create_time, update_time) " +
            "values(#{subject}, #{name}, #{price}, #{target}, #{description}, #{createTime}, #{updateTime})")
    int insert(Course course);

    @Delete("delete from t_course where id = #{id}")
    void delete(Integer id);

    @Select("select * from t_course where id = #{id}")
    Course selectById(Integer id);

    void update(Course course);

    @Select("select * from t_course")
    List<Course> getList();

    @Select("select * from t_course where subject = #{subject}")
    List<Course> getListBySubject(String subject);
}
